package com.asialjim.wechat.official.starter.config;

import com.asialjim.wechat.spring.config.WeChatApiConfigProperties;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * <h1><em>ASIAL JIM JAVA DOC</em></h1><hr/>
 * <h2>CLASS DESCRIPTION <i>[ NAME: WeChatApiAutoConfigProperties ]</i></h2><strong>
 * <p> TODO
 * </strong><p><p><em>Copyright &copy; Asial Jim Co., LTD</em><hr/>
 *
 * @author Asial Jim &nbsp;&nbsp; <span>Email:<a href="mailto:asialjim@hotmail.com">asialjim@hotmail.com</a> &nbsp;&nbsp; <a href="asialjim@qq.com">asialjim@qq.com</a></span>
 * @version 1.0.0
 * @since 2021/3/30   &nbsp;&nbsp; JDK 8
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ConfigurationProperties(prefix = WeChatApiConfigProperties.YAML_PROPERTIES_PREFIX)
public class WeChatApiAutoConfigProperties {

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * http proxy port
     */
    protected Integer port;

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * we-chat business api url domain
     */
    protected String domain;

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * http proxy hostname
     */
    protected String hostname;

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * temp file path when api function is download something
     */
    protected String tempDirFilePath;

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * max retry times for we-chat api http request
     */
    protected Integer weChatApiMaxRetry = 3;

    public WeChatApiConfigProperties properties(){
        return WeChatApiConfigProperties.builder()
                .domain(this.domain)
                .hostname(this.hostname)
                .port(this.port)
                .tempDirFilePath(this.tempDirFilePath)
                .weChatApiMaxRetry(this.weChatApiMaxRetry)
                .build();
    }
}
